package spring;

import com.jyhs.maven.dao.TransferDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopeMetadata;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Objects;

@Component("helloSpring")
@Scope(value = "prototype")
public class HelloSpring {



    // 定义hello属性，该属性的值将通过Spring框架进行设置
    @Value("${hello}")
    private String hello = null;

//    @Autowired
//    @Qualifier("transferDao")
//    @Resource(name = "transferDao")

    @Autowired
    private TransferDao transferDao=null;


    public void printTransferDao() {
        System.out.println(transferDao);
    }

    /**
     * 打印方法，从Spring配置文件中获取属性并输出。
     */
    public void print() {
        System.out.println("Spring say:," + this.getHello() + "!");
    }

    public String getHello() {
        return hello;
    }

    public void setHello(String hello) {
        this.hello = hello;
    }

    public TransferDao getTransferDao() {
        return transferDao;
    }

    public void setTransferDao(TransferDao transferDao) {
        this.transferDao = transferDao;
    }


}
